/**
 *
 */
package com.angel.mocks.data.generator.domainObject;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToOne;

import com.angel.architecture.persistence.base.PersistentObject;

/**
 * @author Williams
 *
 */
@Entity
public class Role extends PersistentObject{

	private static final long serialVersionUID = -8545405223956659246L;

	private String name;
	private String description;

	@OneToOne(optional= true,fetch = FetchType.EAGER)
	private Role subRole;

	public Role(){
		super();
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the subRole
	 */
	public Role getSubRole() {
		return subRole;
	}
	/**
	 * @param subRole the subRole to set
	 */
	public void setSubRole(Role subRole) {
		this.subRole = subRole;
	}

	/** Returns if a role include a sub role. If it is true, the role has sub role permissions.
	 *
	 * @return
	 */
	public boolean hasSubRole(){
		return this.subRole != null;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
}
